package com.simon.hse.activity.safe.workpermit;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.simon.hse.R;
import com.simon.hse.activity.BaseActivity;
import com.simon.hse.activity.SignActivity;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;

/**
 * 申请取消
 */
@ContentView(R.layout.activity_apply_cancel)
@SuppressWarnings("all")
public class ApplyCancelActivity extends BaseActivity {

    @ViewInject(R.id.tv_common_title)
    TextView mTv_common_title;

    private int cancel_flag;// 0-取消查询 1-取消审批

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Bundle bundle = getIntent().getExtras();
        if (bundle==null)
            return;
        cancel_flag = bundle.getInt("CANCEL_FLAG", 0);

        mTv_common_title.setText("作业许可证取消");
    }

    @Event(value = {R.id.iv_common_left,R.id.tv_apply_cancel_submit,R.id.tv_apply_cancel_cancel})
    private void clickButton(View view) {
        switch (view.getId()) {
            case R.id.iv_common_left:
                finish();
                break;
            case R.id.tv_apply_cancel_submit:
                if (cancel_flag==0){
                    Intent intent = new Intent(ApplyCancelActivity.this, SignActivity.class);
                    startActivity(intent);
                }else{
                    finish();
                }
                break;
            case R.id.tv_apply_cancel_cancel:
                finish();
                break;
        }
    }
}
